package com.nlgc365.designpattern.Chapter04_Pattern.Creation.P01_Singleton.Usage.SpringSource;

import com.nlgc365.designpattern.Utils.SomeBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringSourceReading {
    private static Logger logger = LoggerFactory.getLogger(SpringSourceReading.class);

    public static void main(String[] args) {
        ApplicationContext contextA = new ClassPathXmlApplicationContext("applicationContext.xml");
        SomeBean someA = (SomeBean) contextA.getBean("some");
        logger.debug(someA.toString());

        ApplicationContext contextB = new ClassPathXmlApplicationContext("applicationContext.xml");
        SomeBean someB = (SomeBean) contextB.getBean("some2");
        logger.debug(someB.toString());

        System.out.println(contextA.equals(contextB));
    }
}
